﻿<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <title></title>
    <link href="../../resources/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />


    <script src="../../resources/lib/jquery/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="../../resources/lib/jquery/jquery.form.min.js" type="text/javascript"></script>
    <script src="../../resources/lib/ligerUI/js/ligerui.all.js" type="text/javascript"></script>
    <script src="../../resources/lib/TempletData.js"></script>
    <script src="../../resources/lib/citylink.js"></script>
    <script type="text/javascript">
        var listbox = null;
        var addNew = false;
        var myaccount = '../../resources/lib/ligerUI/skins/icons/myaccount.gif';
        $(function () {
            listbox = $("#listbox2").ligerListBox({
                width: "100%",
                height: "100%",
                data: [
                    { text: '授权模板1', id:"1",cardId:"111",type:"身份证",authority:"5",comment:"丢失",Identify:"卡认证",pinCodeLen:"5",duressCodeLen:"5",duressAuthority:"20",memberGroup:"人组1",activeStart:"2013-8-13 16:35:00",activeEnd:"2013-12-13 00:00:00",action:"尾随",areas:"区域1",description:"啦啦"},
                    { text: '授权模板2', id:"2",cardId:"222",type:"IP卡",authority:"4",comment:"损坏",Identify:"密码认证",pinCodeLen:"6",duressCodeLen:"6",duressAuthority:"30",memberGroup:"人组2",activeStart:"2013-6-14 12:20:00",activeEnd:"2014-2-9 00:00:00",action:"报警",areas:"区域2",description:"嗯嗯"},
                    { text: '授权模板3', id:"3",cardId:"333",type:"CPU卡",authority:"3",comment:"被盗",Identify:"卡+密码认证",pinCodeLen:"3",duressCodeLen:"3",duressAuthority:"10",memberGroup:"人组3",activeStart:"2013-5-13 13:40:00",activeEnd:"2013-9-26 00:00:00",action:"禁用",areas:"区域3",description:"无"},
                ],
                //idFieldName :'id',

                onSelect: function(id, text) {
                    addNew = false;
                    var data;
                    for (var i = 0; i < this.data.length; i++) {
                        if (this.data[i].id == id) {
                            data = this.data[i];
                            break;
                        }
                    }
                     $("#form1 input[name=Name]").val(data.text);
                    $("#form1 input[name=cardId]").val(data.cardId);
                    $("#form1 input[name=type]").val(data.type);
                    $("#form1 input[name=authority]").val(data.authority);
                    $("#form1 input[name=comment]").val(data.comment);
                    $("#form1 input[name=Identify]").val(data.Identify);
                    $("#form1 input[name=pinCodeLen]").val(data.pinCodeLen);
                    $("#form1 input[name=duressCodeLen]").val(data.duressCodeLen);
                    $("#form1 input[name=duressAuthority]").val(data.duressAuthority);
                    $("#form1 input[name=memberGroup]").val(data.memberGroup);
                    $("#form1 input[name=activeStart]").val(data.activeStart);
                    $("#form1 input[name=activeEnd]").val(data.activeEnd);
                    $("#form1 input[name=action]").val(data.action);
                    $("#form1 input[name=areas]").val(data.areas);
                    $("#form1 input[name=description]").val(data.description);
                }
            });
            $("#form1").ligerForm();
            $('#form1').ajaxForm(function() {
                alert("form1 ajax submit end!");
            });

        });

        function addTemplet() {
            $("#form1 input[name='Name']").val("新建权限模板");

            addNew = true;
        }
        function removeItem() {

        }
    </script>
    <style type="text/css">
        .l-table-edit {}
        .l-table-edit-td{ padding:4px;}
        .l-button-submit,.l-button-reset{width:80px; float:left; margin-left:10px; padding-bottom:2px;}
        form fieldset {
            border: solid #CCCCCC 1px;
            padding: 10px;
        }
        form fieldset legend {
            padding: 0 2px;
        }
    </style>
</head>
<body id="layout1" style="width:100%; margin:0 auto;">
<div style="position:absolute; left: 5px; top: 5px; right: 5px; height: 25px; ">
    <a class="l-button" onclick="addTemplet()" style="float:left;margin-right:10px; width: 80px;">添加权限模板</a>
    <a class="l-button" onclick="removeItem()" style="float:left;margin-right:10px;">删除</a>
    <br style="clear: both;" />
</div>

<div style="position:absolute; left: 5px; top: 35px; bottom: 5px; width: 190px; border:1px solid #ccc; overflow:auto;  ">
    <ul id="listbox2" style="border: none;">
    </ul>
</div>

<div style="position:absolute; left: 202px; right: 5px; top: 35px; bottom: 5px; border:1px solid #ccc; overflow:auto; padding: 5px;">

    <div id="dialog_target"  style="margin:5px;">
        <form id="form1" name="form1" method="post" action="">
            <fieldset style="float: center;">
                <legend>基本信息</legend>

                <table cellpadding="0" cellspacing="0" class="l-table-edit" >
                    <tr>
                        <td align="right" class="l-table-edit-td">名称:</td>
                        <td align="left" class="l-table-edit-td">
                            <input name="Name" type="text" id="Name" ltype="text" />
                        </td>
                        <td align="right" class="l-table-edit-td">认证方式:</td>
                        <td align="left" class="l-table-edit-td">
                            <select name="Identify" id="Identify" ltype="select">
                                <option value="1">卡验证</option>
                                <option value="2">密码验证</option>
                                <option value="3">卡+密码验证</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="l-table-edit-td" valign="top">人组:</td>
                        <td align="left" class="l-table-edit-td">
                            <select name="memberGroup" id="memberGroup" ltype="select">
                                <option value="1">人组1</option>
                                <option value="2">人组2</option>
                                <option value="3">人组3</option>
                            </select>
                        </td>
                        <td align="right" class="l-table-edit-td" valign="top">证章模板:</td>
                        <td align="left" class="l-table-edit-td">
                            <select name="badgeTemplate" id="badgeTemplate" ltype="select">
                                <option value=""></option>
                            </select>
                        </td>
                    </tr>

                    <tr>
                        <td align="right" class="l-table-edit-td">动作:</td>
                        <td align="left" class="l-table-edit-td">
                            <select name="action" id="action" ltype="select">
                                <option value="1">尾随</option>
                                <option value="2">报警</option>
                                <option value="3">禁用</option>
                            </select>
                        </td>
                        <td align="right" class="l-table-edit-td">描述:</td>
                        <td align="left" class="l-table-edit-td">
                            <input name="description" type="text" id="description" ltype="text" />
                        </td>

                    </tr>

                </table>

            </fieldset>
            <fieldset style="float: center;">
                <legend>卡信息</legend>

                <table cellpadding="0" cellspacing="0" class="l-table-edit" >
                    <tr>
                        <td align="right" class="l-table-edit-td">卡号:</td>
                        <td align="left" class="l-table-edit-td">
                            <input name="cardId" type="text" id="cardId" ltype="number" />
                        </td>
                        <td align="right" class="l-table-edit-td">卡类型:</td>
                        <td align="left" class="l-table-edit-td">
                            <select name="type" id="type" ltype="select">
                                <option value="1">身份证</option>
                                <option value="2">IP卡</option>
                                <option value="3">CPU卡</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="l-table-edit-td" valign="top">卡等级:</td>
                        <td align="left" class="l-table-edit-td">
                            <input name="authority" type="text" id="authority" ltype="number" />
                        </td>
                        <td align="right" class="l-table-edit-td" valign="top">卡附加信息:</td>
                        <td align="left" class="l-table-edit-td">
                            <select name="comment" id="comment" ltype="select">
                                <option value="1">丢失</option>
                                <option value="2">损坏</option>
                                <option value="3">被盗</option>
                            </select>
                        </td>
                    </tr>
                </table>

            </fieldset>

            <fieldset style="float: center;">
                <legend>密码信息</legend>

                <table cellpadding="0" cellspacing="0" class="l-table-edit" >
                    <tr>

                        <td align="right" class="l-table-edit-td">pin码长度:</td>
                        <td align="left" class="l-table-edit-td">
                            <input name="pinCodeLen" type="text" id="pinCodeLen" ltype="number" />
                        </td>
                        <td align="right" class="l-table-edit-td" valign="top">胁迫码长度:</td>
                        <td align="left" class="l-table-edit-td">
                            <input name="duressCodeLen" type="text" id="duressCodeLen" ltype="number" />
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="l-table-edit-td" valign="top">胁迫等级:</td>
                        <td align="left" class="l-table-edit-td">
                            <input name="duressAuthority" type="text" id="duressAuthority" ltype="number" />
                        </td>
                    </tr>
                </table>

            </fieldset>
            <fieldset style="float: center;">
                <legend>规则信息</legend>

                <table cellpadding="0" cellspacing="0" class="l-table-edit" >
                    <tr>
                        <td align="right" class="l-table-edit-td">时间规则特权:</td>
                        <td align="left" class="l-table-edit-td">
                            <input name="timeRule" type="checkbox"  id="timeRule"  />
                        </td>
                        <td align="right" class="l-table-edit-td">多人规则特权:</td>
                        <td align="left" class="l-table-edit-td">
                            <input name="abRule" type="checkbox" id="abRule"  />
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="l-table-edit-td" valign="top">潜回特权:</td>
                        <td align="left" class="l-table-edit-td">
                            <input name="lineRule" type="checkbox" id="lineRule" ltype="number" />
                        </td>
                        <td align="right" class="l-table-edit-td" valign="top">允许通过区域:</td>
                        <td align="left" class="l-table-edit-td">
                            <select name="areas" id="areas" ltype="select">
                                <option value="1">区域1</option>
                                <option value="2">区域2</option>
                                <option value="3">区域3</option>
                            </select>
                        </td>
                    </tr>
                </table>

            </fieldset>
            <fieldset style="float: center;">
                <legend>时间信息</legend>

                <table cellpadding="0" cellspacing="0" class="l-table-edit" >
                    <tr>
                        <td align="right" class="l-table-edit-td">生效时间:</td>
                        <td align="left" class="l-table-edit-td">
                            <input name="activeStart" type="text" ltype="date" data-editor="{showTime:true}"/>
                        </td>
                        <td align="right" class="l-table-edit-td">失效时间:</td>
                        <td align="left" class="l-table-edit-td">
                            <input name="activeEnd" type="text" ltype="date" data-editor="{showTime:true}"/>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" class="l-table-edit-td" valign="top">延长开门时间(秒):</td>
                        <td align="left" class="l-table-edit-td">
                            <input name="accessTimeExtension" type="text" id="accessTimeExtension" ltype="number" />
                        </td>
                    </tr>
                </table>

            </fieldset>


            <div style="clear: both; padding-top: 10px;">
                <input type="submit" value="提交" class="l-button l-button-submit" />
                <input type="reset" value="重置" class="l-button l-button-reset"/>
                <br class="l-clear" />
            </div>
        </form>
    </div>
</div>
</body>
</html>
